<%= tag.div :class => ["mb-3 border-bottom border-secondary-subtle pb-3",
                       { "text-body-secondary" => relation.redacted? && params[:show_redactions] }] do %>
  <% if relation.redacted? && !params[:show_redactions] %>
    <%= t "browse.redacted.message_html",
          :type => t("browse.redacted.type.relation"),
          :version => relation.version,
          :redaction_link => link_to(t("browse.redacted.redaction",
                                       :id => relation.redaction.id), relation.redaction) %>
  <% else %>
    <%= render :partial => "browse/common_details", :object => relation %>

    <% unless relation.containing_relation_members.empty? %>
      <h4><%= t "browse.part_of" %></h4>
      <details <%= "open" if relation.containing_relation_members.count < 10 %>>
        <summary><%= t "browse.part_of_relations", :count => relation.containing_relation_members.uniq.count %></summary>
        <ul class="list-unstyled browse-element-list">
          <%= render :partial => "browse/containing_relation", :collection => relation.containing_relation_members.uniq %>
        </ul>
      </details>
    <% end %>

    <% unless relation.relation_members.empty? %>
      <h4><%= t ".members" %></h4>
      <details <%= "open" if relation.relation_members.count < 10 %>>
        <summary><%= t ".members_count", :count => relation.relation_members.count %></summary>
        <% if relation.relation_members.count >= 10 %>
          <turbo-frame id="member_relation_<%= relation.id %>"
            <% if relation.is_a?(OldRelation) %>
              <% path_params = [relation.relation_id, relation.version] %>
              <% path_params << { :show_redactions => params[:show_redactions] } if params[:show_redactions] %>
              src="<%= old_relation_members_path(*path_params) %>">
            <% else %>
              src="<%= relation_members_path(relation) %>">
            <% end %>
            <div class="text-center my-2">
              <div class="spinner-border spinner-border-sm text-primary" role="status">
                <span class="visually-hidden">Loading...</span>
              </div>
            </div>
          </turbo-frame>
        <% else %>
          <ul class="list-unstyled browse-element-list">
            <%= render :partial => "browse/relation_member", :collection => relation.relation_members %>
          </ul>
        <% end %>
      </details>
    <% end %>
  <% end %>
<% end %>
